Secure Apache & Nginx MIME types with X

您所在的位置:网站首页 nginx mimetype Secure Apache & Nginx MIME types with X

Secure Apache & Nginx MIME types with X

2024-07-10 14:58| 来源: 网络整理| 查看: 265

X-Content-Type-Options Header Implementation in Apache, Nginx, IBM HTTP Server & Shared Hosting

Every resource served from a web server is associated with MIME type (also called content-type).

There is a possibility to execute style sheet and steal content from another site through content type doesn’t match. You may prevent this vulnerability in Internet Explorer or Google Chrome by adding nosniff in the header.

In this quick guide, I will explain how to add X-Content-Type-Options header in Apache HTTP, Nginx, IHS & Shared hosting to reduce MIME types attack risk.

Few things Take a backup of an existing configuration file to restore if something goes wrong. To verify the header response, you may use the HTTP Header Checker online tool. If you are using cloud-based Security Protection like SUCURI, then you don’t have to worry, as this is already enabled by default. Apache and IBM HTTP Server Modify the httpd.conf file and ensure mod_headers.so is enabled. The following line should be uncommented. LoadModule headers_module modules/mod_headers.so Add following parameter Header set X-Content-Type-Options nosniff Save the configuration file and restart Apache to take effects.

Here is how the header response looks like.

x-content-type-results

Nginx Web Server Add the following parameter in nginx.conf under server block add_header X-Content-Type-Options nosniff; Save the nginx.conf file and restart Nginx to see the results. Implementation in Shared Hosting

If you are using shared hosting like SiteGround or anyone who offers .htaccess file.

Login to your cPanel and go to File Manager Modify .htaccess file and add the following Header set X-Content-Type-Options nosniff Save the file and refresh the page to see the results.

I hope this adds a layer of security to your site.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3